package com.kgc.controller;


import com.kgc.dto.ClassifyDto;
import com.kgc.dto.Result;
import com.kgc.service.ClassifyService;
import com.kgc.pojo.Classify;
import com.kgc.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 商品分类 前端控制器
 * </p>
 *
 * @author zsy
 * @since 2021-08-04
 */
@RestController
@RequestMapping("/api/home")
public class ClassifyController {

    @Autowired
    private ClassifyService classifyService;

    @GetMapping("/findAll")
    public List<Classify> findAll(){
        return classifyService.list();
    }

    @GetMapping("/classifyTree")
    public Result<List<Classify>> findClassifyTree(){
        List<ClassifyDto> list = classifyService.findClassifyTree();
        return ResultUtils.returnDataSuccess(list);
    }
}

